// 从config中引入常量，从ajax中引入'getJSON'
import { SUCC_CODE, TIMEOUT } from './ajax/config'
import { getJSON } from './ajax';
// 封装getData函数
const getData = (url, options) => {
    return getJSON(url, { timeoutTime: TIMEOUT, ...{ options } }).then((response) => {
        if (response.code !== SUCC_CODE) throw new Error(`出错了:${response.code}`);
        return response.data;
    }).catch(err => { console.log(err) });
}
// 引出'getData'
export { getData };